<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery-1.11.0.min.js"></script>
    <script src="js/province.js"></script>



</head>
<<body>
<h1 align="center">个人中心</h1>
<table  width="80%" align="center">
    <tr>
        <td align="left"><a href="login.html">安全退出</a></td>
        <td align="right">
            <a href="index.html">首页</a>

        </td>
    </tr>
</table>
<table width="30%" align="left" cellspacing="0" cellpadding="1">
    <tr>
        <td align="right" style="width: 100px ;height: 80px" ><img src="img/123.jpg" width="200" height="200"></a></td>
    </tr>
</table>
<table width="80%" align="center" border="1" >

    <tr>
        <th colspan="2">个人信息</th>
    </tr>
    <tr>
        <td>姓名</td>
        <td id="name">11111</td>
    </tr>
    <tr>
        <td>性别</td>
        <td >
            <select>
                <option value="1">男</option>
                <option value="2">女</option>
            </select>

        </td>
    </tr>
    <tr>
        <td>国籍</td>
        <td>
            <select id="sel1">
                <option value="1">中国</option>
                <option value="2">美国</option>
                <option value="3">英国</option>
                <option value="4">日本</option>
                <option value="5">俄罗斯</option>
                <option value="6">法国</option>
            </select>
        </td>
        </tr>
    <tr>
        <td>证件类型</td>
        <td>
            <select id="sel2">
                <option value="1">居民身份证</option>
                <option value="2">护照</option>
                <option value="3">港澳通行证</option>
                <option value="4">士官证</option>
            </select>
        </td>
    </tr>

    <tr>
            <td >证件号码</td>
            <td id="card">证件号码</td>
    </tr>
    <tr>
            <td>电话号码</td>
            <a name="phone"></a>
            <td  id="phone" >电话号码</td>
    </tr>
    <tr>
        <td>密码</td>
        <td id="password1">密码</td>
    </tr>

    <tr>
        <td>联系地址</td>
        <td>
                <script language="javascript" src="province.js" type="text/javascript" charset="utf-8"></script>
                <body onload='getProvince()'>
                <select id="province" onchange="chooseProvince(this)">
                    <option value="1">请选择省</option>
                </select>
                <select id="city" onchange="chooseCity(this)">
                    <option value="2">请选择市</option>
                </select>
                <select id="area">
                    <option value="3">请选择区</option>
                </select>
                </body>
        </td>
    </tr>
    <tr>
        <td>详细地址</td>
        <td ><input type="text" name="detailed_address" id="detailed_address"></td>
    </tr>
</table>
    <table width="10%" align="center"  >
    <tr>
        <td align="center">
            <input type="button" value="修改" style="font-size: 15px; background-color: darkorange;width: 200px;height: 40px;color: aliceblue" id="regist1">
    </tr>

<!--        <script>-->
<!--            // $("#regist1").click(function () {-->
<!--            //     // let detailed = $("detailed_address").val();-->
<!--            //     // //发送异步请求，实现信息修改-->
<!--            //     // $.post("regist1",{"detailed":detailed},function (data) {-->
<!--            //     //         if (data == 'y'){-->
<!--            //     //             alert("修改成功");-->
<!--            //     //             window.location.href="personal.html"-->
<!--            //     //-->
<!--            //     //         }else {-->
<!--            //     //             alert("修改失败")-->
<!--            //     //         }-->
<!--            //     },"text");-->
<!--            // });-->
<!--            -->
<!--        </script>-->




</table>

</body>
<script>
    $("#regist1").click(function () {
        let detailedAddress = $("#detailed_address").val();
        let phone = $("#phone").val();
        $.get("updatepersonal",{"detailedAddress":detailedAddress},function (data) {
           if (data='修改成功'){
               alert("修改成功")
           }else {data='修改失败'
               alert(
                   "修改失败"
               )
           }
        },"text")
    })
</script>
<script>
    // alert("3333")
    //异步请求
    //1.请求的url
    //2.发送请求的时候，向后台携带的数据
    //3.载入成功时回调函数（只有当Response的返回状态是success才调该方法）自动将请求结果和状态传递给该方法
    //后台返回的数据格式（xml,html,script,json,text和default）
    $.get("personalList",{},function (data){
        // alert(typeof (data))
        // for (let i=0;i<data.length;i++){
        //     let personal =data[i];
            let personal = data;
            console.log(personal)
            $("#name").html(personal.p_name);
            $("#gard").html(personal.p_Gender);
            $("#bank").html(personal.credit_card);
            $("#money").html(personal.aum);
            $("#card").html(personal.id_card);
            $("#phone").html(personal.p_phone);
            $("#dz").html(personal.detailed_address);
            $("#password1").html(personal.password);

            // document.getElementById("two").innerHTML += "<tr>\n"+
            //     "            <td>"+personal.cash_card+"</td>\n" +
            //     "            <td>"+personal.credit_card+"</td>\n" +
            //     "        </tr>"
            // document.getElementById("three").innerHTML += "<tr>\n"+
            //      "            <td>"+personal.p_name+"</td>\n" +
            //     "            <td>"+personal.p_Gender+"</td>\n" +
            //     "            <td>"+personal.p_nationality+"</td>\n" +
            //     "            <td>"+personal.document_type+"</td>\n" +
            //
            //     "        </tr>"
            // document.getElementById("four").innerHTML += "<tr>\n"+
            //     "            <td>"+personal.id_card+"</td>\n" +
            //     "            <td>"+personal.p_phone+"</td>\n" +
            //     "            <td>"+personal.contact_address+"</td>\n" +
            //     "            <td>"+personal.detailed_address+"</td>\n" +
            //     "        </tr>"
        // }
    },"json");
</script>
</html>